#ifndef __DETU_MEDIA_VI_MIPI_IMP_H__
#define __DETU_MEDIA_VI_MIPI_IMP_H__

#include "vi_mipi.h"
#include "mutex.h"

#include "hi_mipi.h"

namespace detu_media
{

class ViMgrImp;

class ViMipiImp: public ViMipi
{

protected:
	ViMipiImp(void);
	
	virtual ~ViMipiImp(void);

	friend class ViMgrImp;
	
private:
	static S_Result setMipiHsMode(const Json::Value& config);

	static S_Result enableSensorClock(void);

	static S_Result disableSensorClock(void);

	static S_Result resetSensor(void);

	static S_Result unresetSensor(void);

	S_Result init(const Json::Value& config);

	S_Result deInit(void);

	bool isInited(void);

	S_Result enableMipiClock(void);

	S_Result disableMipiClock(void);

	S_Result resetMipi(void);

	S_Result unresetMipi(void);

	S_Result setMipiAttr(void);

private:

	constexpr static const combo_dev_attr_t defaultDevAttr =
	{
	    .devno 							= 0,
	    .input_mode 					= INPUT_MODE_MIPI,
	    .data_rate 						= MIPI_DATA_RATE_X1,
	    .img_rect 						= 
	    {
	    	.x 							= 44,
			.y 							= 136,
			.width 						= 3968,
			.height 					= 2768
		},
	    {
	        .mipi_attr 					=
	        {
	            .input_data_type 		= DATA_TYPE_RAW_12BIT,
	            .wdr_mode 				= HI_MIPI_WDR_MODE_NONE,
	            .lane_id 				= {-1, -1, -1, -1, -1, -1, -1, -1}
	        }
	    }
	};
	

private:
	static lane_divide_mode_t fLaneDivMode;
	static detu_infra::Mutex fStaticMutex;
	combo_dev_attr_t fDevAttr;
	bool fInited;

	detu_infra::Mutex fMutex;
};

}

#endif

